import storage_set from '@feidao/web/atom/browser/storage/put';
import storage_get from '@feidao/web/atom/browser/storage/get';

import nodejs from "@feidao/web/atom/browser/msg/nodejs";
import { IFeidaoAiBrowserComponent } from '@feidao/web/interfaces';

export default async function get_db(fd: IFeidaoAiBrowserComponent, filter: any) {
	const dt = await storage_get('certifi_type', 'db');
	if (!dt) {
		const data = await nodejs(fd.data.spaceid, 'certifi_type_find', { filter });
		await storage_set('industry', data, 'db');
		return data;
	} else {
		return dt;
	}
}